home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / osi / isode / vmsisode / vmsisode80_tar.Z / vmsisode80_tar / sockit / gccinclude / flexskeldef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-24  |  2.3 KB  |  82 lines

  1. /* macro definitions for compressed-table C/FTL programs generated by flex */
  2.  
  3. #include "flexskelcom.h"
  4.  
  5. /* reinitializes everything except the current start condition.  The last
  6.  * input character is set to a newline so an initial beginning-of-line
  7.  * rule will match
  8.  */
  9. #define YY_INIT \
  10.     { \
  11.     yyleng = yy_c_buf_p = yy_e_buf_p = 0; \
  12.     yy_hold_char = yy_ch_buf[yy_c_buf_p] = '\n'; \
  13.     yytext = &yy_ch_buf[yy_c_buf_p]; \
  14.     yy_saw_eof = 0; \
  15.     }
  16.  
  17. /* returns the length of the matched text */
  18. #define YY_LENG (yy_c_buf_p - yy_b_buf_p + 1)
  19.  
  20. /* pushes one character back onto the input buffer.  The character is put in
  21.  * a position such that it logically follows the last character matched by
  22.  * some rule
  23.  */
  24. #define YY_UNPUT(c) \
  25.     { \
  26.     YY_DO_BEFORE_SCAN; /* undo effects of setting up yytext */ \
  27.     if ( yy_c_buf_p == 0 ) \
  28.         YY_SHIFT_UP; \
  29.     if ( yy_c_buf_p <= 0 ) \
  30.         YY_FATAL_ERROR( "flex scanner push-back overflow" ); \
  31.     if ( yy_c_buf_p >= yy_b_buf_p && yy_ch_buf[yy_c_buf_p] == '\n' ) \
  32.         yy_ch_buf[yy_c_buf_p - 1] = '\n'; \
  33.     yy_ch_buf[yy_c_buf_p--] = c; \
  34.     YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  35.     }
  36. #define unput YY_UNPUT
  37.  
  38. /* moves the input buffer up into the top of its region.  Assumes
  39.  * yy_c_buf_p is 0.
  40.  */
  41. #define YY_SHIFT_UP \
  42.     { \
  43.     yy_buf_pos = YY_BUF_MAX; \
  44.     YY_DO_THE_SHIFT; \
  45.     yy_c_buf_p = YY_BUF_MAX - yy_e_buf_p; \
  46.     yy_e_buf_p = YY_BUF_MAX; \
  47.     }
  48.  
  49. /* tight loop to do the actual copying of the input buffer to the top of
  50.  * its region
  51.  */
  52. #define YY_DO_THE_SHIFT \
  53.     for( yy_iii = yy_e_buf_p; yy_iii >= yy_c_buf_p; --yy_iii ) \
  54.     { \
  55.     yy_ch_buf[yy_buf_pos] = yy_ch_buf[yy_iii]; \
  56.     yy_st_buf[yy_buf_pos] = yy_st_buf[yy_iii]; \
  57.     --yy_buf_pos; \
  58.     }
  59.  
  60. /* done before the next pattern has been matched action */
  61. #define YY_DO_BEFORE_SCAN \
  62.     yytext[yyleng] = yy_hold_char;
  63.  
  64. /* done after the current pattern has been matched and before the corresponding action */
  65. #define YY_DO_BEFORE_ACTION \
  66.     yytext = &yy_ch_buf[yy_b_buf_p]; \
  67.     yyleng = YY_LENG; \
  68.     yy_hold_char = yytext[yyleng]; \
  69.     yytext[yyleng] = '\0';
  70.  
  71. /* find the next rule matched */
  72. #ifdef FLEX_REJECT_ENABLED
  73. #define REJECT \
  74.         { \
  75.     YY_DO_BEFORE_SCAN; /* undo effects of setting up yytext */ \
  76.         ++yy_lp; \
  77.         goto find_rule; \
  78.         }
  79. #else
  80. #define REJECT YY_FATAL_ERROR( "REJECT used and scanner was not generated using -r" )
  81. #endif
  82.